// Loesung_von_Aufgabe_11.4_1_Bifurkationsdiagramm

float x = 0.1; // Startwert für x
float y;
float a = 2.8; // Startwert für a
float i = 0;

void setup() 
{
  size(1100, 600);
  background(255);
}

void draw() 
{
  for (a = 2.8; a < 4.0; a = a + 0.000001)
  {
    // Iterationsvorschrift
    y = a*x*(1-x); 
    x = y;

    // Punkte werden gezeichnet
    stroke(0);
    strokeWeight(3);
    point(1000*a-2900, 500*y);
  }

  // Koordinatensystem
  stroke(0, 0, 200);
  strokeWeight(5);
  line(0, 550, 1030, 550);
  line(20, 60, 20, 600);
  line(109, 550, 109, 560);
  line(609, 550, 609, 560);
  fill(0, 0, 200);
  triangle(1020, 545, 1035, 550, 1020, 555);
  triangle(15, 70, 20, 50, 25, 70);

  // Text
  fill(0, 0, 200);
  textSize(34);
  text("Bifurkationsdiagramm", 250, 100);
  text("y", 10, 30);
  text("a", 1045, 555); 
  textSize(24);
  text("3,0", 90, 585);
  text("3.5", 590, 585);

  if (a > 4.001)
    noLoop();
}